#!/bin/bash

RUNTYPE="$1"
if [ -z "$RUNTYPE" ]; then
    RUNTYPE="reportbrokenclient"
fi
SERIAL=`ioreg -l | grep IOPlatformSerialNumber | awk '{print $4}' | tr -d '"'`
NAME="$(echo `systemsetup -getcomputername | cut -d: -f2-`)"
SUBMITURL="REPLACE_BASEURL/update"

# Application paths
CURL="/usr/bin/curl"

$CURL --max-time 5 --silent \
    -d runtype="$RUNTYPE" \
    -d serial="$SERIAL" \
    -d name="$NAME" \
    "$SUBMITURL/report_broken_client"

exit 0
